1. Field of the Invention
This invention relates to a floating-point calculator, and more particularly, to a floating-point calculator having three or more inputs.
2. Related Background Art
In three-dimensional computer graphics (3DCG), various kinds of computation are conducted to generate images. Especially in a phase of geometry arithmetic processing which is the phase of various kinds of processing such as movement of three-dimensional models, three-dimensional and four-dimensional matrix operations are executed frequently. Matrix operation is ascribed to operation of inner products, such as axc3x97a+bxc3x97b+cxc3x97c and axc3x97b+cxc3x97d+exc3x97f, for example. Therefore, along with the progress of the speed of 3DCG processing, there is a demand for technologies capable of high-speed operation of inner products.
FIG. 1 is a block diagram showing a first configuration example of conventional floating-point calculators. This floating-point calculator is configured to execute operation of A+Bxc3x97C of three operands A, B and C. Let exponents of these three operands A, B, C be Ea, Eb, Ec, and let their fixed-point parts be Fa, Fb and Fc. Inner products can be calculated by repeating the operation A+Bxc3x97C.
The conventional floating-point calculator shown in FIG. 1 includes: an adder 201 for adding the exponent Eb of the operand B and the exponent Ec of the operand C and obtaining an exponent Em of the result of multiplication Bxc3x97C of the operands B, C; a subtracter 202 for subtracting the exponent Em from the exponent Ea and obtaining an exponent Ed for digit adjustment of the fixed-point part Fa; a selecting circuit 203 selecting one of the exponents Ea and Em having a larger value; a digit adjusting shifter 204 for calculating a fixed-point part Fsf adjusted in digit from the fixed-point part Fa, based on the exponent Ed; a multiplier 205 for conducting multiplication Fbxc3x97Fc of fixed-point parts Fb and Fc and obtaining a sum component fixed-point part Fs and a carry component fixed-point part Fcr; a preceding zero detecting circuit 206 for counting the number of preceding zeros resulting from the addition Fsf+Fs+Fcr of the fixed-point parts Fsf, Fs and Fcr and obtaining an exponent correction value En for normalization of the operation result; an adder 207 for calculating a fixed-point part Fad resulting from the addition Fsf+Fs+Fcr of the fixed-point parts Fsf, Fs and Fcr; a subtracter 208 for subtracting the exponent correction value En from one of the exponents Ea and Em having a larger value and obtaining an exponent Er of a normalized operation result; and a normalization shifter 209 for conducting a digit adjustment for normalization of the fixed-point part Fad on the basis of the exponent correction value En and obtaining a fixed-point part Fr as an operation result.
The conventional floating-point calculator shown in FIG. 1 operates as explained below.
When exponents Ea, Eb, Ec and fixed-point parts Fa of three operands A, B, C are input, addition Eb+Ec of the exponents Eb and Ec are conducted by the adder 201 first, the exponent Em of the result of multiplication Bxc3x97C of the operands B and C is obtained, and the exponents Em and Ea are input to the subtracter 202 and the selecting circuit 203. In the subtracter 202, subtraction *Ea-Em* of the exponents Ea and Em is conducted, and the exponent Ed for digit adjustment of the fixed-point part Fa is obtained. On the other hand, in the selecting circuit 203, one of the exponents Ea and Em having a larger value is selected. The fixed-point part Fa and the component Ed are input to the digit adjustment shifter 204. In the digit adjustment shifter 204, digit adjustment of the fixed-point part Fa is conducted based on the exponent Ed, and the fixed-point part Fsf is obtained. On the other hand, in the multiplier 204, multiplication Fbxc3x97Fc of the fixed-point parts Fb and Fc is conducted, and the result of the multiplication is calculated separately for the sum component fixed-point part Fs and for the carry component fixed-point part Fcr. These fixed-point parts Fsf, Fs and Fcr are input to the preceding zero detecting circuit 206 and the adder 207. In the preceding zero detecting circuit 206, addition Fsf+Fs+Fcr of the fixed-point parts Fsf, Fs and Fcr is conducted, the number of preceding zeros in the result of the addition is counted, and the exponent correction value En for normalization of the operation result is calculated. In the adder 207, addition Fsf+Fs+Fcr of the fixed-point parts Fsf, Fs and Fcr is conducted, and the fixed-point part Fad is obtained as the result of the addition. One of the exponents Ea and Em having a larger value and the exponent correction value En are input to the adder 208, and the fixed-point part Fad and the exponent correction value En are input to the digit adjusting shifter 209. In the subtracter 208, digit adjustment for normalization of the fixed-point part Fad is conducted based on the exponent correction value En, and the fixed-point part Fr is obtained as the result of operation. Obtaining the exponent Er and the fixed-point part Fr means obtaining the result of operation A+Bxc3x97C. Inner products in a matrix operation are obtained by repeating these operations.
FIG. 2 is a block diagram showing a second configuration example of conventional floating-point calculator. This floating-point calculator is configured to execute operation Axc3x97B+Cxc3x97D+Exc3x97F of six operands A, B, C, D, E and F. Let exponents of six operands A, B, C, D, E and F be Ea, Eb, Ec, Ed, Ee and Ef, and let their fixed-point parts be Fa, Fb, Fc, Fd, Fe and Ff. Three-dimensional inner products can be obtained at the same time by executing the operation Axc3x97B+Cxc3x97D+Exc3x97F.
The conventional floating-point calculator shown in FIG. 2 includes: an adder 301a for adding the exponent Ea of the operand A and the exponent Eb of the operand B, and obtaining an exponent ea as the result of multiplication Axc3x97B of the operands A and B; an adder 301b for adding the exponent Ec of the operand C and the exponent Ed of the operand D, and obtaining an exponent eb as the result of multiplication Cxc3x97D of the operands C and D; and adder 301c for adding the exponent Ee of the operand E and the exponent Ef of the operand F, and obtaining an exponent ec as the result of multiplication Exc3x97F of the operands E and F; a maximum value detecting circuit 302 for detecting the maximum value of the exponents ea, eb and ec calculated by the adders 301a, 301b and 301c; a subtracter 303a for subtracting the maximum value of the exponents ea, eb and ec from the exponent ea, and obtaining the number of digits for digit adjustment; a subtracter 303b for subtracting the maximum value of the exponents ea, eb and ec from the exponent eb, and obtaining the number of digits for digit adjustment; a subtracter 303c for subtracting the maximum value of the exponents ea, eb and ec from the exponent ec, and obtaining the number of digits for digit adjustment; a multiplier 302a for multiplying the fixed-point part Fa of the operand A and the fixed-point part Fb of the operand B and obtaining the multiplication result fa; a multiplier 304b for multiplying the fixed-point part Fc of the operand C and the fixed-point part Fd of the operand D to obtain the multiplication result fb; a multiplier 304c for multiplying the fixed-point part Fe of the operand E and the fixed-point part Ff of the operand F to obtain the multiplication result fc; a digit adjusting shifter 305a for digit adjustment of the operation result fa of the multiplier 304a, based on the operation result of the subtracter 303a; a digit adjusting shifter 305b for digit adjustment of the operation result fb of the multiplier 304b, based on the operation result of the subtracter 303b; a digit adjusting shifter 305c for digit adjustment of the operation result fc of the multiplier 304c, based on the operation result of the subtracter 303c; a preceding zero detecting circuit 306 for counting the number of preceding zeros in the results of addition fa, fb and fc adjusted in digit and obtaining an exponent correction value En for normalization of operation results; an adder 307 for adding fa, fb and fc adjusted in digit; a subtracter 308 for subtracting the exponent correction value En from the maximum value of the exponents ea, eb and ec, and obtaining an exponent Er of a normalized operation result; and a normalization shifter 309 which executes digit adjustment of the result of the addition by the adder 307, based on the exponent correction value En, and obtaining a fixed-point part Fr of the result of operation.
The floating-point calculator shown in FIG. 2 operates as explained below.
When the exponents Ea, Eb, Ec, Ed, Ed and Ef of six operands A, B, C, D, E and F, and their fixed-point parts Fa, Fb, Fc. Fd, Fe and Ff are input, the adders 301a, 301b and 301c conduct addition Ea+Eb of the exponents Ea and Eb, addition Ec+Ed of the exponents Ec and Ed, and addition Ee+Ef of the exponents Ee and Ef, respectively, and produce an exponent ea of the result of multiplication Axc3x97B of the operands A and B, exponent eb as the result of multiplication Cxc3x97D of the operands C and D, and exponent ec as the result of multiplication Exc3x97F of the operands E and F. Once the exponents ea, eb and ec are produced by the adders 301a, 301b and 301c, the maximum value is detected from the exponents ea, eb and ec by the maximum value detecting circuit 302. Detection of the maximum value by the maximum value detecting circuit 302 is performed by comparing all combinations of two numbers among three exponents ea, eb and ec. Subsequently, the maximum value of the exponents ea, eb and ec is subtracted from the exponents ea, eb, ec, respectively, by the subtracters 303a, 303b and 303c, and numbers of digits for digit adjustment are obtained, respectively. On the other hand, the multipliers 304a, 304b and 304c conduct multiplication Faxc3x97Fb of the fixed-point parts Fa and Fb of the operands A and B, multiplication Fcxc3x97Fd of the fixed-point parts Fc and Fd of the operands C and D, and multiplication Fexc3x97Ff of the fixed-point parts Fe and Ff of the operands E and E, respectively, and produce multiplication results fa, fb and fc, respectively. Then, the digit adjusting shifter 305a, 305b and 305c conducts digit adjustment of the operation results fa, fb and fc of the multipliers 304a, 304b and 304c on the basis of the operation results of the subtracters 303a, 303b and 303c. After digit adjustment of the operation results fa, fb and fc, the preceding zero detecting circuit 306 counts the number of preceding zeros in the addition results fa, fb and fc adjusted in digit, and produces an exponent correction value En for normalization of operation results. On the other hand, the adder 307 conducts addition of fa, fb and fc after digit adjustment. Finally, the subtracter 308 subtracts the exponent correction value En from the maximum value among the exponents ea, eb and ec to thereby produce an exponent Er of a normalized operation result, and the normalization shifter 309 conducts digit adjustment for normalization of the addition result of the adder 307 on the basis of the exponent correction value En thereby to produce a fixed-point part as an operation result. Having produced the exponent Er and the fixed-point part Fr means that the operation result of Axc3x97B+Cxc3x97D+Exc3x97F. Therefore, three-dimensional inner products can be obtained at the same time by execution of this operation Axc3x97B+Cxc3x97D+Exc3x97F.
However, in the conventional floating-point calculator shown in FIG. 1 as the first configuration example, since operation of inner products is conducted by repeating addition and multiplication, there was the problem that subsequent operation processing depended upon precedent operation results and it took a time to repeat the processing.
In the conventional floating-point calculator shown in FIG. 1 as the second configuration example, since detection of the maximum value among three exponents ea, eb and ec by the maximum value detecting circuit 302 is conducted by comparing all combination of two numbers among three exponents ea, eb and ec, there was the problem that a lot of hardware resources and processing time were required. Additionally, since the number of digits for digit adjustment was calculated after calculation of the maximum value, the processing speed was low, and digit adjusting shifters for fixed-point parts as many as the number of operands were required. Also in this respect, a lot of hardware resources were required.
It is therefore an object of the invention to provide a floating-point calculator having configuration which enables reduction of hardware resources and improvement of the processing speed.
According to the present invention, there is provided a floating-point calculator including an exponent part calculator device which executes subtraction by sequentially combining exponents of a plurality of operands, and obtains subtraction result exponents of respective combinations to be used as alternatives for the number of digits for digit adjustment of fixed-point parts of the operands and carries of the subtraction, respectively; a maximum value selector device responsive to values of the carries to select one of the exponents of the operands having the maximum value; a digit adjustment object selector device responsive to values of the carries to select a fixed-point part of the operand to be adjusted in digit; and a digit adjustment number-of-digits selector device responsive to values of the carries to select the subtraction result exponent to be used as the number of digits for digit adjustment of the fixed-point part of the operand to be adjusted in digit. In the above mentioned floating-point calculator according to the present invention, since the floating-point calculator according to the invention is configured to obtain the maximum value of exponents of a plurality of operands by using a carry obtained as a result of subtraction combining exponents of a plurality of operands, its select logic is simplified. Further, since digit adjustment shifting can be executed just after a result of the select logic is obtained, the operation speed can be increased, and the hardware resources can be reduced.
According to the present invention in the detailed configuration, there is provided a floating-point calculator including an exponent part adder device which sequentially executes subtraction of every combined two of exponents of a plurality of operands, and obtains subtraction result exponents of respective combinations; a fixed-point part multiplier device which sequentially executes multiplication of every combined two of fixed-point parts of the operands and obtains multiplication result fixed-point parts of respective combinations; an exponent part subtracter device which executes the addition result exponents by sequentially combining them and obtains subtraction result exponents of respective combinations to be used as alternatives for the number of digits for digit adjustment of the multiplication result fixed-point parts and carries of the subtraction, respectively; a maximum value selector device responsive to values of the carries to select one of the addition result exponents having the maximum value; a digit adjustment object selector device responsive to values of the carries to select the multiplication result fixed-point part to be adjusted in digit; a digit adjustment number-of-digits selector device responsive to values of the carries to select the subtraction result exponent to be used as the number of digits for digit adjustment of the multiplication result fixed-point part to be adjusted in digit; a digit adjuster device for digit adjustment of the multiplication result fixed-point part by using selected the subtraction result component; a fixed-point part adder device for executing addition of the multiplication result fixed-point parts adjusted in digit to obtain an addition result fixed-point part; a preceding zero detector device for executing addition of the multiplication result fixed-point parts adjusted in digit, then counting the number of preceding zeros in the addition result fixed-point part obtained, and obtaining a normalization exponent for normalization of the operation result; a normalization operation result exponent calculator device for subtracting the normalization exponent from one of the addition result exponents having the maximum value, and obtaining a normalized operation result exponent; and a normalization operation result fixed-point part calculator device responsive to the normalization exponent to perform digit adjustment for normalization of the addition result fixed-point part and obtaining an operation result fixed-point part.
Further details of the configuration of the floating-point calculator according to the invention will be explained later.